package com.ap.core.validation.message.rules;

import com.ap.core.dao.MerchantCategoryCodeDao;
import com.ap.core.message.managemerchant.info.RequestMerchantRegistrationTypeInfo;
import com.ap.core.validation.message.info.MessageValidationInfo;
import com.ap.core.validation.message.info.OriginalInfo;
import com.ap.core.validation.rules.AbstractValidationRule;

/**
 * User: Dilip.Sridhar
 * Check for the Merchant Category Code is Recognised.
 */
public class RV0024Rule extends AbstractValidationRule<MessageValidationInfo<RequestMerchantRegistrationTypeInfo, OriginalInfo>>   {
	
	private MerchantCategoryCodeDao  merchantCategoryCodeDao;
	
	@Override
    public boolean validate(MessageValidationInfo<RequestMerchantRegistrationTypeInfo,OriginalInfo> infoObject) {
        return null != (merchantCategoryCodeDao.findById(infoObject.getBoundObject().getMerchant().getMerchantCtgyCd()));
    }

	public void setMerchantCategoryCodeDao(
			MerchantCategoryCodeDao merchantCategoryCodeDao) {
		this.merchantCategoryCodeDao = merchantCategoryCodeDao;
	}
	

}
